//
// Created by Zhangwj on 2023/9/25.
//

#include "MainFuncDefNode.h"

std::unique_ptr<MainFuncDefNode> MainFuncDefNode::MainFuncDefParser(Parser &parser) {
    // MainFuncDef → 'int' 'main' '(' ')' Block
    std::unique_ptr<MainFuncDefNode> mainFuncDefNode = std::make_unique<MainFuncDefNode>();
    if (parser.getLexType(0) == LexType::INTTK) {
        parser.next();
    }
    if (parser.getLexType(0) == LexType::MAINTK) {
        parser.next();
    }
    if (parser.getLexType(0) == LexType::LPARENT) {
        parser.next();
    }
    if (parser.getLexType(0) == LexType::RPARENT) {
        parser.next();
    }
    mainFuncDefNode->Block = BlockNode::BlockParser(parser);
    return mainFuncDefNode;
}
